/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.qsdm.es.persistence;

import java.io.Serializable;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author alberto
 */
@Entity
@Table(name = "horariocurso", catalog = "qsdm", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Horariocurso.findAll", query = "SELECT h FROM Horariocurso h"),
    @NamedQuery(name = "Horariocurso.findByHoraInicio", query = "SELECT h FROM Horariocurso h WHERE h.horaInicio = :horaInicio"),
    @NamedQuery(name = "Horariocurso.findByDiaDeLaSemana", query = "SELECT h FROM Horariocurso h WHERE h.horariocursoPK.diaDeLaSemana = :diaDeLaSemana"),
    @NamedQuery(name = "Horariocurso.findByHoraFin", query = "SELECT h FROM Horariocurso h WHERE h.horaFin = :horaFin"),
    @NamedQuery(name = "Horariocurso.findByCurso", query = "SELECT h FROM Horariocurso h WHERE h.horariocursoPK.curso = :curso")})
public class Horariocurso implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected HorariocursoPK horariocursoPK;
    @Basic(optional = false)
    @Column(name = "horaInicio", nullable = false)
    private int horaInicio;
    @Column(name = "horaFin", length = 45)
    private String horaFin;
    @JoinColumn(name = "curso", referencedColumnName = "id", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Curso curso1;

    public Horariocurso() {
    }

    public Horariocurso(HorariocursoPK horariocursoPK) {
        this.horariocursoPK = horariocursoPK;
    }

    public Horariocurso(HorariocursoPK horariocursoPK, int horaInicio) {
        this.horariocursoPK = horariocursoPK;
        this.horaInicio = horaInicio;
    }

    public Horariocurso(int diaDeLaSemana, int curso) {
        this.horariocursoPK = new HorariocursoPK(diaDeLaSemana, curso);
    }

    public HorariocursoPK getHorariocursoPK() {
        return horariocursoPK;
    }

    public void setHorariocursoPK(HorariocursoPK horariocursoPK) {
        this.horariocursoPK = horariocursoPK;
    }

    public int getHoraInicio() {
        return horaInicio;
    }

    public void setHoraInicio(int horaInicio) {
        this.horaInicio = horaInicio;
    }

    public String getHoraFin() {
        return horaFin;
    }

    public void setHoraFin(String horaFin) {
        this.horaFin = horaFin;
    }

    public Curso getCurso1() {
        return curso1;
    }

    public void setCurso1(Curso curso1) {
        this.curso1 = curso1;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (horariocursoPK != null ? horariocursoPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Horariocurso)) {
            return false;
        }
        Horariocurso other = (Horariocurso) object;
        if ((this.horariocursoPK == null && other.horariocursoPK != null) || (this.horariocursoPK != null && !this.horariocursoPK.equals(other.horariocursoPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.qsdm.es.persistence.Horariocurso[ horariocursoPK=" + horariocursoPK + " ]";
    }
    
}
